home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / snpd9611.zip / SNIPKBIO.H < prev    next >
C/C++ Source or Header  |  1996-11-24  |  3KB  |  78 lines

  1. .I 0 4
  2. /* +++Date last modified: 23-Nov-1996 */
  3.  
  4. /*
  5. **    SNIPKBIO.H - Snippets header file for keyboard I/O function
  6. .D 1 2
  7. .I 9 1
  8. #include "sniptype.h"
  9. .I 11 67
  10. Boolean_T getYN(char *prompt, int def_ch,             /* Getyn.C        */
  11.                 unsigned timeout);
  12.  
  13. int  IsLeftShift(void);                        /* Isshift.C    */
  14. int  IsRightShift(void);                    /* Isshift.C    */
  15. int  IsShift(void);                        /* Isshift.C    */
  16.  
  17. int  IsLeftAlt(void);                        /* Isshift.C    */
  18. int  IsRightAlt(void);                        /* Isshift.C    */
  19. int  IsAlt(void);                            /* Isshift.C    */
  20.  
  21. int  IsLeftCtl(void);                        /* Isshift.C    */
  22. int  IsRightCtl(void);                        /* Isshift.C    */
  23. int  IsCtl(void);                            /* Isshift.C    */
  24.  
  25. int  IsSysRq(void);                         /* Isshift.C    */
  26. int  timed_getch(int n_seconds);                      /* Timegetc.C    */
  27. int  isxkeybrd(void);                                 /* Isxkbrd.C    */
  28. void setcaps(void);                                   /* Keylocks.C    */
  29. void clrcaps(void);                        /* Keylocks.C    */
  30. void setnumlock(void);                        /* Keylocks.C    */
  31. void clrnumlock(void);                        /* Keylocks.C    */
  32.  
  33. #define     RIGHT_SHIFT     0x0001
  34. #define     LEFT_SHIFT        0x0002
  35.  
  36. #define     EITHER_ALT        0x0008
  37. #define     LEFT_ALT        0x0200
  38.  
  39. #define     EITHER_CTL        0x0004
  40. #define     LEFT_CTL        0x0100
  41.  
  42. #if defined(__OS2__)
  43.  #define    SYSRQ            0x8000
  44. #else    /* assume DOS */
  45.  #define    SYSRQ            0x0400
  46. #endif
  47.  
  48. #ifdef __OS2__
  49.  #define INCL_NOPM
  50.  #define INCL_KBD
  51.  #define INCL_DOSPROCESS    /* for DosSleep() */
  52.  #include <os2.h>
  53.  
  54. KBDINFO setkbmode(void);    /* Change keyboard to binary mode */
  55. void restkbmode(KBDINFO);   /* restore keyboard mode */
  56.                             /* both defined in EXT_KEYS.C */
  57.  
  58. /* 30-Mar-96 - EBB:
  59. ** OS/2 doesn't have a place in memory where information about the last
  60. ** key is held, like DOS does.    All the information about a keystroke is
  61. ** wrapped up into a structure (KBDKEYINFO) returned from OS/2's
  62. ** get-a-key API call, KbdCharIn(), so if you want to query that information
  63. ** at some arbitrary later time, you have to save it somewhere.  I have
  64. ** chosen to use a global variable defined in ISSHIFT.C to do this.  The
  65. ** functions in ISSHIFT.C report the status of the last key stored in that
  66. ** global, which may not be the last key pressed in your program if you're
  67. ** also storing keystrokes elsewhere.
  68. */
  69. extern KBDKEYINFO ki;        /* Holds key info - defined in ISSHIFT.C */
  70.  
  71.  #define peekkey()    (&ki.fsState)
  72. #else    /* !__OS2__ */
  73.  #define key_seg    0x40
  74.  #define key_off    0x17
  75.  #define peekkey()    ((unsigned short FAR*) MK_FP(key_seg, key_off))
  76. #endif
  77. .D 12 21
  78.